//-----------------------------------
//Author:Alvin
//Date:14:48:47
//-----------------------------------

using UnityEngine;

/// <summary>
/// 卡牌MODel
/// </summary>
public class ObstacleDataModel
{
    /// <summary>
    /// 扑克换算数字
    /// </summary>
    private int cardNum;

    /// <summary>
    /// 扑克图片名字
    /// </summary>
    private string cardSpriteName;

    /// <summary>
    /// 扑克花色
    /// </summary>
    private string huase;

    /// <summary>
    /// 扑克面值
    /// </summary>
    private string cardValue;
    
    /// <summary>
    /// 逻辑值
    /// </summary>
    private int logicValue;

    /// <summary>
    /// 道具类型
    /// 1:随机摸牌道具 2：随机弃手牌道具 3:炸弹  4：随机获得指定的牌
    /// </summary>
    private int kind;

    /// <summary>
    /// 获取设置道具类型
    /// </summary>
    public void SetKind(int kind)
    {
        if (kind < 1 || kind > 4)
        {
            Debug.LogError("道具类型异常"+kind);
            return;
        }

        this.kind = kind;
    }


    /// <summary>
    /// 获取道具类型
    /// </summary>
    /// <returns></returns>
    public int GetKind()
    {
        return kind;
    }
    
    
    /// <summary>
    /// 获取card的数字
    /// </summary>
    /// <returns></returns>
    public int GetCardNum()
    {
        return cardNum;
    }

    /// <summary>
    /// 设置卡的数字
    /// </summary>
    /// <param name="cardNum"></param>
    public void SetCardNum(int cardNum)
    {
        this.cardNum = cardNum;
        this.logicValue = cardNum % 13;
    }
    
    /// <summary>
    /// 获取逻辑值(用于算牌)
    /// </summary>
    /// <returns></returns>
    public int GetLogicValue()
    {
        return logicValue;
    }
    
    /// <summary>
    /// 图片名字
    /// </summary>
    /// <returns></returns>
    public string GetCardSpriteName()
    {
        return cardSpriteName;
    }

    /// <summary>
    /// 获取扑克面值
    /// </summary>
    /// <returns></returns>
    public string getCardValue()
    {
        return cardValue;
    }

    /// <summary>
    /// 设置card的图片名字
    /// </summary>
    /// <param name="cardSpriteName"></param>
    public void setCardSpriteName(string cardSpriteName)
    {
        if (string.IsNullOrEmpty(cardSpriteName))
        {
            Debug.LogError("cardSpriteName is null or empty");
            return;
        }

        string[] array = cardSpriteName.Split('_');
        huase = array[0];
        cardValue = array[1];
        this.cardSpriteName = cardSpriteName;
    }

}